<template>
  <div>
    <el-row>
      <el-col :span="20" :offset="2">
        <el-card style="width: 100%; margin-top: 20px;">
          <h1 style="text-align: center">消息中心</h1>
          <el-table :data="messageList" style="width: 100%;margin-top:30px;" stripe>
            <el-table-column 
              prop="title" 
              align="center" 
              label="标题">
            </el-table-column>
            <el-table-column 
              prop="content" 
              align="center" 
              label="内容"
              :show-overflow-tooltip='true'>
            </el-table-column>
            <el-table-column 
              prop="type" 
              align="center" 
              label="类型">
            </el-table-column>
            <el-table-column 
              prop="status" 
              align="center" 
              label="状态">
            </el-table-column>
            <el-table-column 
              prop="createat" 
              align="center" 
              label="创建时间">
            </el-table-column>
            <el-table-column align="center" label="操作">
              <template slot-scope="scope">
                <el-button type="text" size="small" @click="handleStatus(scope)">已读</el-button>
                <!-- <el-button type="text" size="small" @click="handleDetail(scope)">详情</el-button>
                <el-button type="text" size="small" @click="handleDelivery(scope)">发货</el-button> -->
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>


export default {
  name: "login",
  data() {
    return {
      messageList: {
        title: '',
        content: '',
      },
      // rules: {
      //   username: [{required: true, message: '用户名不能为空', trigger: 'blur'}],
      //   password: [{required: true, message: '密码不能为空', trigger: 'blur'}]
      // }
    }
  },
  methods: {
    submit(){
      this.$refs.loginForm.validate(v => {
        if (v) {
          // TODO 用户登录 跳转到导航页
          this.$store.dispatch('user/login', this.loginForm)
            .then(() => {
              this.$router.push({ path: this.$route.query.redirect || '/' })
            })
            .catch(() => {
              this.$message.error('登录失败');
            })
          // console.log(this.loginForm)
          // this.$router.push({ path: this.$route.query.redirect || '/' })
        } else {
          return false
        }
      })
    }
  },
}
</script>

<style scoped>

</style>
